$(function () {
  $("#ce").stop().animate({ top: "0", right: "0" }, 500);
  $("#xin6")
    .children()
    .eq(0)
    .mouseover(function () {
      $("#damao").css({ display: "block" });
    });
  $("#xin6")
    .children()
    .eq(0)
    .mouseout(function () {
      $("#damao").css({ display: "none" });
    });
  $("#xin6")
    .children()
    .eq(1)
    .mouseover(function () {
      $("#zuo1").css({ display: "block" });
    });
  $("#xin6")
    .children()
    .eq(1)
    .mouseout(function () {
      $("#zuo1").css({ display: "none" });
    });
  $("#damao").mouseover(function () {
    $(this).css({ display: "block" });
  });
  $("#damao").mouseout(function () {
    $(this).css({ display: "none" });
  });
  $("#zuo1").mouseover(function () {
    $(this).css({ display: "block" });
  });
  $("#zuo1").mouseout(function () {
    $(this).css({ display: "block" });
  });
  $("#zuo1 li").mouseover(function () {
    $("#zuo2").css({ display: "block" });
  });
  $("#zuo1 li").mouseout(function () {
    $("#zuo2").css({ display: "none" });
  });
  $("#zuo2").mouseover(function () {
    $("#zuo2").css({ display: "block" });
    $("#zuo1").css({ display: "block" });
  });
  $("#zuo2").mouseout(function () {
    $("#zuo2").css({ display: "none" });
    $("#zuo1").css({ display: "none" });
  });

  $.ajax({
    url: "http://jx.xuzhixiang.top/ap/api/allproductlist.php",
    type: "get",
    data: { pagesize: 12, pagenum: 0, uid: 74599 },
    success: function (data) {
      let skr = data.data;
      console.log(skr);
      let str = "";
      skr.forEach((item) => {
        str += `
        <div class="lie1" data-id=${item.pid}>
            <div class="lie2">
                <img src="https://img2.epetbar.com/nowater/2016-08/12/16/9b2a0f6e0564c6503dbf2ae141183dfd.jpg"
                    alt="" >
            </div>
            <div class="lie4">
                <a href="xiangqing.html"><img src="${item.pimg}"
                    alt=""></a>
            </div>
            <div class="lie5">
                <img src="${item.pimg}"
                    alt="">
                <img src="${item.pimg}"
                    alt="">
            </div>
            <div class="lie3">
                <img src="https://static.epetbar.com/static_wap/appmall/lib/list/activity.png?version=2016120201"
                    alt="">
                    ${item.pname}
            </div>
            <div class="lie6">
                <p>￥238.8.</p><span>￥${item.pprice}</span>
            </div>
            <div class="lie7">
                <p>月销3604箱</p>
            </div>
         </div>`;
      });
      $("#liebiao").html(str);
      $(".lie1").click(function () {
        let hezi = $(this).attr("data-id");
        console.log(hezi);
        localStorage.setItem("data-id", hezi);
      });
    },
  });
});
